<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Listener</title>
<script type="text/javascript" src="swf.js"></script>
</head>
<body>
<div id="listener_div"></div>
<div id="message"></div>
<script type="text/javascript">
function sendData(data){
	var listener = SWF.get("listener");
	if (listener) {
		listener.sendData(data);
	}
}

function ondata(data) {
	output(data);
	
	sendData(data);
}

function onstate(data) {
	//status, error, warning
	output(data);
}

function onloaded() {
	output("loaded");
	sendData("listener loaded");
}

function output(msg)  {
	var child = document.createElement("div");
	child.innerHTML = msg;
	document.getElementById("message").appendChild(child);
}

var htm = SWF.create("listener", "1", "1", "listener.swf", {lc:"connect_name", ondata:"ondata", onstate:"onstate", onloaded:"onloaded"});
document.getElementById("listener_div").innerHTML = htm;
</script>
</body>
</html>
